package www.openteam.com.presenter.realtime;

import java.util.HashMap;
import java.util.List;

import www.openteam.com.base.BasePresenter;
import www.openteam.com.bean.TakeDeliverGoods;
import www.openteam.com.contract.realtime.TakeGoodsContract;
import www.openteam.com.model.realtime.TakeGoodsModel;
import www.openteam.com.mvp.IModel;
import www.openteam.com.ui.realtime.TakeGoodFragment;

/**
 * Created by kylin on 2017/1/4.
 */

public class TakeGoodPresenter extends
        BasePresenter<TakeGoodFragment>
        implements TakeGoodsContract.TakeGoodsPresenter {
    @Override
    public HashMap<String, IModel> getiModelMap() {
        return loadModelMap(new TakeGoodsModel());
    }

    @Override
    public HashMap<String, IModel> loadModelMap(IModel... models) {

        HashMap<String, IModel> hashMap = new HashMap<>();
        hashMap.put("queryTDeliverGoods", models[0]);

        return hashMap;
    }

    @Override
    public void queryTDeliverGoods(String rdsno, String custid,
                                   long startDate,
                                   long endDate, String stype, String moreCom,int userId,String jMark,int pageSize) {
        ((TakeGoodsModel) getiModelMap().get("queryTDeliverGoods"))
                .queryTDeliverGoods(rdsno, custid, startDate, endDate,stype,moreCom,userId,jMark,pageSize
                        , new TakeGoodsModel.TakeGoodsOnListener() {
                            @Override
                            public void queryDGSuccess(List<TakeDeliverGoods.DataBean> data) {
                                getIView().queryTGSuccess(data);
                            }

                            @Override
                            public void queryDGFail(String failMsg) {
                                getIView().queryTGFail(failMsg);
                            }
                        });

    }
}
